//package com.tqjc.system.core.redis;
//
//import org.springframework.beans.factory.annotation.Value;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.data.redis.connection.RedisConnectionFactory;
//import org.springframework.data.redis.connection.RedisStandaloneConfiguration;
//import org.springframework.data.redis.connection.jedis.JedisConnectionFactory;
//import org.springframework.data.redis.core.RedisTemplate;
//import org.springframework.data.redis.serializer.StringRedisSerializer;
//
//import javax.annotation.Resource;
//
///**
// * @Description:库区Redis配置
// * @author: pzy
// * @date: 2022年05月05日 15:20
// */
//@Configuration
//public class AreaRedisConfig extends RedisConfig{
//
//    @Value("${spring.redis.host}")
//    private String host;
//
//    @Value("${spring.redis.port}")
//    private int port;
//
//
//    public JedisConnectionFactory redisConnectionFactoryForArea() {
//        RedisStandaloneConfiguration redisStandaloneConfiguration = new RedisStandaloneConfiguration();
//        redisStandaloneConfiguration.setHostName(host);
//        redisStandaloneConfiguration.setPort(port);
//        return new JedisConnectionFactory(redisStandaloneConfiguration);
//    }
//
//
////    @Bean(name = "redisTemplate")
////    @SuppressWarnings("all")
////    public RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory factory) {
////        RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
////        template.setConnectionFactory(factory);
////        FastJson2JsonRedisSerializer fastJsonRedisSerializer = new FastJson2JsonRedisSerializer(Object.class);
////        StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
////        // key采用String的序列化方式
////        template.setKeySerializer(stringRedisSerializer);
////        // hash的key也采用String的序列化方式
////        template.setHashKeySerializer(stringRedisSerializer);
////        // value序列化方式采用jackson
////        template.setValueSerializer(fastJsonRedisSerializer);
////        // hash的value序列化方式采用jackson
////        template.setHashValueSerializer(fastJsonRedisSerializer);
////        template.afterPropertiesSet();
////        return template;
////    }
//
//
//    //Template工厂
//    @Resource(name = "areaRedisTemplate")
//    public RedisTemplate AreaRedisTemplate() {
//        RedisTemplate<String, Object> template = new RedisTemplate();
//        template.setConnectionFactory(redisConnectionFactoryForArea());
//        setSerializer(template);
//        template.afterPropertiesSet();
//        return template;
//    }
//}
